// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "ds/typography.scss" as t;
@use "refactor/common-refactor.scss" as deprecated;

.version-toolbox {
  padding: deprecated.$s-8;
  height: 100%;
  display: grid;
  overflow: hidden;
  grid-template-rows: auto auto 1fr;
}

.versions-entry-empty {
  align-items: center;
  color: var(--color-foreground-secondary);
  display: flex;
  flex-direction: column;
  font-size: deprecated.$fs-12;
  gap: deprecated.$s-8;
  padding: deprecated.$s-16;
}

.versions-entry-empty-icon {
  background: var(--color-background-tertiary);
  border-radius: 50%;
  padding: deprecated.$s-8;
  display: flex;
}

.version-save-version {
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-foreground-secondary);
  font-size: deprecated.$fs-12;
  padding: deprecated.$s-16 0 deprecated.$s-16 deprecated.$s-16;
  justify-content: space-between;
  width: 100%;
  display: flex;
  align-items: center;
}

.version-save-button {
  background: none;
  border: none;
  cursor: pointer;
}

.versions-entries {
  display: flex;
  flex-direction: column;
  gap: deprecated.$s-6;
  overflow: auto;
  margin: 0;
}

.version-entry {
  border: 1px solid transparent;

  p {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  &:hover .version-entry-options {
    visibility: initial;
  }
}

.version-entry {
  display: flex;
  padding: deprecated.$s-4 deprecated.$s-4 deprecated.$s-4 deprecated.$s-16;
  gap: deprecated.$s-8;
  border-radius: 8px;
  align-items: center;

  &:hover {
    border-color: var(--color-accent-primary);
  }
}

.version-entry.is-autosave {
  flex-direction: column;
  align-items: start;
  padding-left: deprecated.$s-48;
  gap: 0;
}

.version-entry-wrap {
  position: relative;
}

.version-entry-avatar {
  border-radius: 50%;
  width: deprecated.$s-24;
  height: deprecated.$s-24;
}

.version-entry-data {
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.version-entry-name {
  color: var(--color-foreground-primary);
  border-bottom: 1px solid transparent;
}

.version-entry-name-edit {
  font-size: deprecated.$fs-12;
  color: var(--color-foreground-primary);
  background: none;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  border-bottom: 1px solid var(--color-foreground-secondary);
}

.version-entry-time {
  color: var(--color-foreground-secondary);
}

.version-entry-options {
  background: none;
  border: 0;
  cursor: pointer;
  visibility: hidden;
  padding: 0;
  height: deprecated.$s-40;
  width: deprecated.$s-32;
}

.version-options-dropdown {
  @extend .dropdown-wrapper;
  position: absolute;
  width: fit-content;
  max-width: deprecated.$s-200;
  right: 0;
  left: unset;
  top: var(--offset);
  .menu-option {
    @extend .dropdown-element-base;
  }
}

.version-entry-snapshots {
  display: flex;
  align-items: center;
  gap: deprecated.$s-6;
  color: var(--color-foreground-secondary);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;

  .icon-clock {
    stroke: var(--color-accent-warning);
  }

  .icon-arrow {
    stroke: var(--color-foreground-secondary);
  }

  &:hover {
    color: var(--color-accent-primary);
    .icon-arrow {
      stroke: var(--color-accent-primary);
    }
  }

  .is-expanded & .icon-arrow {
    transform: rotate(90deg);
  }
}

.version-snapshot-list {
  display: none;
  margin-top: deprecated.$s-8;
  flex-direction: column;
  width: 100%;

  .version-entry.is-expanded & {
    display: flex;
  }
}

.version-snapshot-entry-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;

  &:hover .version-snapshot-menu-btn {
    visibility: initial;
  }
}

.version-snapshot-entry {
  font-size: deprecated.$fs-12;
  color: var(--color-foreground-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  justify-content: space-between;
  width: 100%;
  white-space: nowrap;

  &:hover {
    color: var(--color-accent-primary);
  }

  &:active {
    color: var(--color-accent-primary);
    :global(.icon-pin) {
      visibility: initial;
      fill: var(--color-accent-primary);
    }
  }
}

.version-snapshot-menu-btn {
  visibility: hidden;
}

.cta {
  @include t.use-typography("body-small");
  color: var(--color-foreground-secondary);

  a {
    color: var(--color-accent-primary);
  }
}
